#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<netinet/in.h>
#include<string.h>

#define MAXLINE 10
#define SERV_PORT 8000

int main(){
  struct sockaddr_in servaddr;
  char buf[MAXLINE];
  int sockfd,i;
  char ch='a';

  sockfd=socket(AF_INET,SOCK_STREAM,0);
  bzero(&servaddr,sizeof(servaddr));
  servaddr.sin_family=AF_INET;
  servaddr.sin_port=htons(SERV_PORT);
  servaddr.sin_addr.s_addr=htonl(INADDR_ANY);

  connect(sockfd,(struct sockaddr *)&servaddr,sizeof(servaddr));
  while(1){
    for(i=0;i<MAXLINE/2;++i){
      for(i=0;i<MAXLINE/2;++i){
	buf[i]=ch;
      }
      buf[i-1]='\n';
      ch++;
      for(;i<MAXLINE;++i){
	buf[i]=ch;
      }
      buf[i-1]='\n';
      ch++;

      write(sockfd,buf,sizeof(buf));
      sleep(5);
    }
  }
  return 0;
}
